package com.ssy.lingxi.contract.model.constant;

import java.util.Arrays;

/**
 *  合同操作类型.
 * @author ds
 * @date 2021/5/10
 * @version 2.0.0
 */
public enum ContractOperateTypeEnum {
    UNKNOW(0, "未知"),
    ADD(1, "新增"),
    UPDATE(2, "修改"),
    CHANGE_CONTRACT(3, "变更合同");

    private final Integer code;
    private final String message;

    ContractOperateTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String getMessage(Integer code) {
        return Arrays.stream(ContractOperateTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(UNKNOW).getMessage();
    }
}
